home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.19950929-19951130
/
000172_news@columbia.edu_Sat Oct 21 09:35:38 1995.msg
< prev
next >
Wrap
Internet Message Format
|
1995-12-25
|
4KB
Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA14288
(5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Sun, 22 Oct 1995 11:07:17 -0400
Received: by apakabar.cc.columbia.edu id AA27429
(5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Sun, 22 Oct 1995 11:07:16 -0400
Path: news.columbia.edu!spcuna!news.wctc.net!chi-news.cic.net!uwm.edu!cs.utexas.edu!news.cs.utah.edu!cc.usu.edu!jrd
From: jrd@cc.usu.edu (Joe Doupnik)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: Is there a bug in fonction \Fcode(Char)
Message-Id: <1995Oct21.153538.64426@cc.usu.edu>
Date: 21 Oct 95 15:35:38 MDT
References: <468l5o$sai@midgard.calvacom.fr>
Organization: Utah State University
Lines: 92
Apparently-To: kermit.misc@watsun.cc.columbia.edu
In article <468l5o$sai@midgard.calvacom.fr>, do11@calvacom.fr (Dominique Ottello) writes:
> Hello from France.
>
> I think there is a bug into Kermit MS-DOS Version 3.14
> The fonction \Fcode(Char) return the value 150 for a space as for u-circomflex
>
> I try this :
>
> define line == SERIAL NUMBER : D00536 ==
> ;
> ; Search for position of (:) into Line
> assign Begin \Findex(:,\m(Ligne),1) <<< TYPO, \m(line)
> increment Begin
> ;
> ; Extract substring beginning after (:) to the end of Line into SN2End
> assign SN2End \Fsubstr(\m(Line),\m(Begin),)
> ;
> define \%n 1
> :Bcl
> assign Tmp \Fsubstr(\m(SN2End),\%n,1)
> ;
> assign Ascii \Fcode(\m(Tmp))
> echo {Char=\m(Tmp) Code=\m(Ascii)}
> ;
> ; Test if the character is a Space
> if = \m(Ascii) 32 goto LenOK
> increment \%n
> goto Bcl
> ;
> :LenOK
> decrement \%n
> assign SN \Fsubstr(\m(SN2End),1,\%n)
> echo Line=\M(Line)
> echo {SN extracted from Line=\m(SN)}
>
> There are spaces after D00536 into variable Line,
> but the fonction \Fcode(\m(Tmp)) always return 150 when Tmp is a space.
> So, I am not able to test where ends the serial number.
>
> Is there a patch to correct this problem ?
> Or is there any possibility to do this test another way ?
>
> Best Regards
>
> Dominique Ottello
> do11@calvacom.fr
---------
The problem is straight forward to discover and to solve. It is
a \fsubstr() operation can result in a space, and if that is the only
definition for an ASSIGN command then the definition appears to be empty
and the variable is undefined/removed.
Aside from the typo noted above here is a version of your script
which works. Note that you have a possible infinite loop, which should
be avoided by set count \flength(string), ... if count to terminate
after examining all string bytes. I removed some of your lines by ;;;
comment indicators and slipped in the count saftey net.
define line == SERIAL NUMBER : D00536 ==
;
; Search for position of (:) into Line
assign Begin \Findex(:,\m(Line),1)
increment Begin
;
; Extract substring beginning after (:) to the end of Line into SN2End
assign SN2End \Fsubstr(\m(Line),\m(Begin),)
;
define \%n 1
;; optional safety net by jrd
set count \flength(SN2End)
:Bcl
;;;assign Tmp \Fsubstr(\m(SN2End),\%n,1)
;
;;;assign Ascii \Fcode(\m(Tmp))
assign Ascii \Fcode(\Fsubstr(\m(SN2End),\%n,1))
;;;echo Char=\m(Tmp) Code=\m(Ascii)
echo Char=\Fsubstr(\m(SN2End),\%n,1) Code=\m(Ascii)
;
; Test if the character is a Space
if = \m(Ascii) 32 goto LenOK
increment \%n
;; optional safety net by jrd
if count -
goto Bcl
;
:LenOK
decrement \%n
assign SN \Fsubstr(\m(SN2End),1,\%n)
echo Line=\M(Line)
echo {SN extracted from Line=\m(SN)}
Joe D.